import Mock from 'mockjs';

export default {
    className: "system.model.Dictionary",
    queryData: function(postData) {
        return Mock.mock({
            isSuccess: "Y",
            reason: "",
            message: [],
            "data": {
                "recordCount": 38,
                "pageCount": 1,
                "pageIndex": 1,
                "pageSize": 20,
                "queryResult|38": [{
                    "keyID|1000-9999": 1000,
                    "variableName": Mock.mock('@ctitle'),
                    "variableCode": /^[A-Z][A-Z][A-Z][A-Z][A-Z]$/,
                    "variableValue": Mock.mock('@ctitle'),
                    "typeName": Mock.mock('@ctitle'),
                    "typeCode": /^[A-Z][A-Z][A-Z][A-Z][A-Z]$/,
                    "status": "有效",
                    "lastUpdatedBy": "admin",
                    "lastUpdateTime": Mock.mock('@now'),
                    "version": 1,
                }],
            }
        });
    },
    queryByKeyID: function(postData) {
        return Mock.mock({
            isSuccess: "Y",
            reason: "",
            message: [],
            "data": {
                "keyID|1000-9999": 1000,
                "variableName": Mock.mock('@ctitle'),
                "variableCode": /^[A-Z][A-Z][A-Z][A-Z][A-Z]$/,
                "variableValue": Mock.mock('@ctitle'),
                "typeName": Mock.mock('@ctitle'),
                    "typeCode": /^[A-Z][A-Z][A-Z][A-Z][A-Z]$/,
                "status": "有效",
                "lastUpdatedBy": "admin",
                "lastUpdateTime": Mock.mock('@now'),
                "version": 1,
            }
        });

        // var curFindObject = null;
        // for (var i = 0; i < definitionJson.length; i++) {
        //     if (postData.keyID == definitionJson[i].keyID) {
        //         curFindObject = definitionJson[i];
        //         break;
        //     }
        // }
        // if (curFindObject == null) {
        //     return Mock.mock({
        //         isSuccess: "Y",
        //         reason: "",
        //         message: [],
        //         "data": {
        //             "keyID|1000-9999": 2000,
        //             "languageCode": /^[0-Z][0-Z][0-Z][0-Z][0-Z]$/,
        //             "languageName": Mock.mock('@ctitle'),
        //             "status": "有效",
        //             "lastUpdatedBy": "admin",
        //             "lastUpdateTime": Mock.mock('@now'),
        //             "version": 1,
        //         }
        //     });
        // } else {
        //     return {
        //         isSuccess: "Y",
        //         reason: "",
        //         message: [],
        //         data: curFindObject,
        //     };
        // }


    },
};